package com.ruoyi.project.oms.paeaAuAuditDetailfifldInfo.controller;

import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.oms.paeaAuAuditDetailfifldInfo.domain.PaeaAuAuditDetailfifldInfo;
import com.ruoyi.project.oms.paeaAuAuditDetailfifldInfo.service.IPaeaAuAuditDetailfifldInfoService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import java.util.Arrays;

import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 预警详情头信息Controller
 *
 * @author gang.wei
 * @date 2020-04-05
 */
@Controller
@RequestMapping("/oms/paeaAuAuditDetailfifldInfo")
public class PaeaAuAuditDetailfifldInfoController extends BaseController
{
    private String prefix = "oms/paeaAuAuditDetailfifldInfo";

    @Autowired
    private IPaeaAuAuditDetailfifldInfoService paeaAuAuditDetailfifldInfoService;

    @RequiresPermissions("oms:paeaAuAuditDetailfifldInfo:view")
    @GetMapping()
    public String paeaAuAuditDetailfifldInfo()
    {
        return prefix + "/paeaAuAuditDetailfifldInfo";
    }

    /**
     * 查询预警详情头信息列表
     */
    @RequiresPermissions("oms:paeaAuAuditDetailfifldInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PaeaAuAuditDetailfifldInfo paeaAuAuditDetailfifldInfo)
    {
        startPage();
        List<PaeaAuAuditDetailfifldInfo> list = paeaAuAuditDetailfifldInfoService.list(new QueryWrapper<>(paeaAuAuditDetailfifldInfo));
        return getDataTable(list);
    }

    /**
     * 导出预警详情头信息列表
     */
    @RequiresPermissions("oms:paeaAuAuditDetailfifldInfo:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(PaeaAuAuditDetailfifldInfo paeaAuAuditDetailfifldInfo)
    {
        List<PaeaAuAuditDetailfifldInfo> list = paeaAuAuditDetailfifldInfoService.list(new QueryWrapper<>(paeaAuAuditDetailfifldInfo));
        ExcelUtil<PaeaAuAuditDetailfifldInfo> util = new ExcelUtil<PaeaAuAuditDetailfifldInfo>(PaeaAuAuditDetailfifldInfo.class);
        return util.exportExcel(list, "paeaAuAuditDetailfifldInfo");
    }

    /**
     * 新增预警详情头信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存预警详情头信息
     */
    @RequiresPermissions("oms:paeaAuAuditDetailfifldInfo:add")
    @Log(title = "预警详情头信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(PaeaAuAuditDetailfifldInfo paeaAuAuditDetailfifldInfo)
    {
        return toAjax(paeaAuAuditDetailfifldInfoService.saveOrUpdate(paeaAuAuditDetailfifldInfo));
    }

    /**
     * 修改预警详情头信息
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        PaeaAuAuditDetailfifldInfo paeaAuAuditDetailfifldInfo = paeaAuAuditDetailfifldInfoService.getById(id);
        mmap.put("paeaAuAuditDetailfifldInfo", paeaAuAuditDetailfifldInfo);
        return prefix + "/edit";
    }

    /**
     * 修改保存预警详情头信息
     */
    @RequiresPermissions("oms:paeaAuAuditDetailfifldInfo:edit")
    @Log(title = "预警详情头信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(PaeaAuAuditDetailfifldInfo paeaAuAuditDetailfifldInfo)
    {
        return toAjax(paeaAuAuditDetailfifldInfoService.saveOrUpdate(paeaAuAuditDetailfifldInfo));
    }

    /**
     * 删除预警详情头信息
     */
    @RequiresPermissions("oms:paeaAuAuditDetailfifldInfo:remove")
    @Log(title = "预警详情头信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(paeaAuAuditDetailfifldInfoService.removeByIds(Arrays.asList(ids.split(","))));
    }
}
